﻿using System.Collections.Generic;
using System.Linq;
using ZilLion.Service.Core.DapperWrapper.SqlServer;
using ZilLion.Service.TaskPlatform.Domain.Entity;
using ZilLion.Service.TaskPlatform.Domain.Respository.Interface;

namespace ZilLion.Service.TaskPlatform.Domain.Respository.Sqlserver
{
    public class NodeInfoRespository : SqlServerRespository<NodeInfoEntity>, INodeInfoRespository

    {
        public NodeInfoRespository()
        {
            Context = new TaskRunnerSqlserverContext();
        }

        public IEnumerable<NodeInfoEntity> GetNodeInfoEntities()
        {
            return GetList("select * from node_info");
        }

        public NodeInfoEntity GetNodeInfoByNodeId(string nodeId)
        {
            return GetList("select * from node_info where nodeid=@nodeId", new {nodeId}).FirstOrDefault();
        }

        public void AddNodInfo(NodeInfoEntity node)
        {
            Add(node);
        }

        public void MotifyNodeInfo(NodeInfoEntity node)
        {
            Modify(node);
        }
    }
}